package ybt.entity;

import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import ybt.custom.BaseEntity;

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class SysDept extends BaseEntity<Integer>{
	private String name;
	private SysDept parent;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@ManyToOne
	public SysDept getParent() {
		return parent;
	}
	public void setParent(SysDept parent) {
		this.parent = parent;
	}
	
	@Transient
	public Integer getParentId() {
		return parent==null?null:parent.getId();
	}
	
}
